<?php

$haplotip = 0;
$nokgen = 0;
$transgen = 0;
$soj = 0;

if (!isset($_GET['id'])) $id = 0;
else $id = $_GET['id'];

if ($id>0) {
	$query = "SELECT * FROM mis WHERE id=" . $id . ";";
	$result = myQuery($query);
	if (! ($row = mysql_fetch_array($result))) myDie("Kriticna greska sa id miša... ", "misevi.php");
	else $action = "edit&id=" . $row['id'] . "&type=mis";

	$haplotip = $row['haplotip'];
	$nokgen = $row['nokgen'];
	$transgen = $row['transgen'];
	$soj = $row['soj'];
}
else $action = "new&type=mis";

print("<form method='POST' action=\"exec/misevi.php?action=" . $action . "\">");
?>

<div class='content' style='width: 400px'>
<span class='contentTitle'> Informacije o mišu </span>
<table class='tableResult' cellspacing='0' width='100%'>
	<tr>
		<th scope='row' class='spec' width="100px"> Vrsta </th>
		<td> 
			<select name='misVrsta' style='width:100%'>
				<option value='mis'> miš </option>
				<option value='stakor'> štakor </option>
			</select>
		</td>
	</tr>
	
	<tr>
		<th scope='row' class='spec'> Haplotip </th>
		<td> 
			<select name='misHaplotip' style='width:100%'>
				<?php printOptionsOfAtributes("haplotip", "naziv",0,"noEmptySpaces", $haplotip)?>
			</select>
	 	</td> 
	 </tr>
	
	<tr>
		<th scope='row' class='spec'> Nokautirani gen </th>
		<td>			
			<select name='misNokgen' style='width:100%'>
				<?php printOptionsOfAtributes("nokgen", "naziv",0,"noEmptySpaces", $nokgen)?>
			</select>
		</td> 
	</tr>
	
	<tr>
		<th scope='row' class='spec' > Transgen </th>
		<td> 
			<select name='misTransgen' style='width:100%'>
				<?php printOptionsOfAtributes("transgen", "naziv",0,"noEmptySpaces", $transgen)?>
			</select>		
		</td> 
	</tr>
	
	<tr>
		<th scope='row' class='spec'> Soj </th>
		<td> 			
			<select name='misSoj' style='width:100%'>
				<?php printOptionsOfAtributes("soj", "naziv",0,"noEmptySpaces", $soj)?>
			</select> 
		</td> 
	</tr>
	
	<tr>
		<th scope='row' class='spec'> Info </th>
		<td> 
			<textarea name='misInfo' rows='3' cols='28'><?php if ($id>0) print($row['info']); ?></textarea>
		</td> 
	</tr>
	
	<tr><th scope='row' class='spec' colspan='2'> <center><input type='submit' value='Spremi promjene'></center>  </th>
</table>
</div>
<?php print("</form>"); ?>